﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucForumTemplates.ascx.cs" Inherits="WCrawler.Controls.ucForumTemplates" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>
<asp:UpdatePanel ID="SearhThreadUpdatePanel" runat="server">
        <ContentTemplate>
    <div>
            <asp:Button ID="btnAddForumTemplate" runat="server" onclick="btnAddForumTemplate_Click" 
                Text="Add Forum Template" />
        <br />
    </div>
    <div>
        <asp:GridView ID="gridViewForumTemplates" runat="server" 
            AutoGenerateColumns="False" DataKeyNames="TemplateDetailsId,ForumId" 
            DataSourceID="ForumTemplateDetailsLinqDataSource" Width="100%" 
            BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" 
            CellPadding="3" GridLines="Vertical" 
            onrowdatabound="gridViewForumTemplates_RowDataBound" AllowSorting="True" 
            onrowcommand="gridViewForumTemplates_RowCommand">
            <AlternatingRowStyle BackColor="#DCDCDC" />
            <Columns>
                <%--<asp:TemplateField HeaderText="Id" SortExpression="TemplateDetailsId">
                    <ItemTemplate>
                        <asp:Label ID="lblTemplateDetailsId" runat="server" Text='<%# Eval("TemplateDetailsId") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>--%>
                <asp:TemplateField HeaderText = "Template">
                    <ItemTemplate>
                        <asp:Label ID="lblTemplate" runat="server"></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Pattern" SortExpression="TemplatePattern">
                    <ItemTemplate>
                        <asp:Label ID="lblTemplatePattern" runat="server" Text='<%# Eval("TemplateDetail.TemplatePattern") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText = "Is Default" SortExpression="IsDefault">
                    <ItemTemplate>
                        <asp:CheckBox ID="chkIsDefault" runat="server" AutoPostBack="true" Checked='<%#Eval("TemplateDetail.IsDefault")%>'></asp:CheckBox>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Update" SortExpression="TemplateDetailsId">
                    <ItemTemplate>
                        <asp:LinkButton ID="btnChangeTemplateDetailsId" runat="server" Text="Change" CommandName="Change" CommandArgument='<%#Eval("TemplateDetailsId")%>'
                            onclick="btnChangeTemplateDetailsId_Click"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:CommandField ShowDeleteButton="True" />
            </Columns>
            <EmptyDataTemplate>
                <asp:Label ID="lblEmptySearch" runat="server" Font-Bold="True" ForeColor="#0033CC">No Results Found....  
                </asp:Label>
            </EmptyDataTemplate>
            <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
            <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
            <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
            <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#0000A9" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#000065" />
        </asp:GridView>
    </div>
            <br />
    <div>
    <!-- Popup show full content-->
    <asp:Button id="btnShowPopup" runat="server" style="display:none" />
    <ajaxtoolkit:modalpopupextender ID="mdlPopup" runat="server" 
        PopupControlID="PanelHtmlCode"
        TargetControlID="btnShowPopup"
        BackgroundCssClass="BackgroundStyle"
        >
    </ajaxtoolkit:modalpopupextender>
    <asp:Panel ID="PanelHtmlCode" runat="server" BackColor="#ffffff"
       BorderColor="#dadada" BorderStyle="Solid" BorderWidth="4px"
        Width="900px" Font-Names="Arial" Font-Size="10pt">
   <table cellpadding="10" cellspacing="0" style="width: 100%">
      <tr>
         <td>
        <asp:GridView ID="gridViewTemplateDetails" runat="server" 
            AutoGenerateColumns="False" DataKeyNames="TemplateDetailsId" 
            DataSourceID="TemplateDetailsLinqDataSource" Width="100%" 
            BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" 
            CellPadding="4" AllowSorting="True">
            <EmptyDataTemplate>
                <asp:Label ID="lblEmptySearch" runat="server" Font-Bold="True" ForeColor="#0033CC">No Results Found....  
                </asp:Label>
            </EmptyDataTemplate>
            <Columns>
                <asp:TemplateField HeaderText="Select" ItemStyle-HorizontalAlign="Center">
                    <HeaderTemplate>
                    <asp:CheckBox ID="chkHead" runat="server" onclick="changeCheckState(this);" />
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="chkCheckItem" Runat="server" />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="#" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:Label ID="lblNum" Runat="server" />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                </asp:TemplateField>
                <asp:TemplateField HeaderText = "Template" SortExpression="Template.TemplateName">
                    <ItemTemplate>
                        <asp:Label ID="lblTemplate" runat="server" Text='<%#Bind("Template.TemplateName")%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="TemplatePattern" HeaderText="Pattern"
                    SortExpression="TemplatePattern"/>
                <asp:TemplateField HeaderText = "Default">
                    <ItemTemplate>
                        <asp:CheckBox ID="chkIsDefault" runat="server" AutoPostBack="true" Checked='<%#Eval("IsDefault")%>'></asp:CheckBox>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:CheckBox ID="chkIsDefault" runat="server" AutoPostBack="true" Checked='<%#Eval("IsDefault")%>'></asp:CheckBox>
                    </EditItemTemplate>
                </asp:TemplateField>
            </Columns>
            <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
            <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
            <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
            <RowStyle BackColor="White" ForeColor="#003399" />
            <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
            <SortedAscendingCellStyle BackColor="#EDF6F6" />
            <SortedAscendingHeaderStyle BackColor="#0D4AC4" />
            <SortedDescendingCellStyle BackColor="#D6DFDF" />
            <SortedDescendingHeaderStyle BackColor="#002876" />
        </asp:GridView>
         </td>
      </tr>
      <tr>
         <td align="center" valign="middle">
             <asp:Button ID="btnAdd" runat="server" onclick="btnAdd_Click" Text="Add" />
            <asp:Button ID="btnCancel" runat="server" Text="Cancel" /><br />
            <asp:Label ID="lblMessage" runat="server" Text=""></asp:Label>
         </td>
      </tr>
   </table>
    </asp:Panel>
</div>
    </ContentTemplate>
        </asp:UpdatePanel>
        
        <asp:LinqDataSource ID="ForumTemplateDetailsLinqDataSource" runat="server" 
            ContextTypeName="WCrawlerLib.LinqDataClassesDataContext" EntityTypeName="" 
            TableName="ForumTemplateDetails" EnableUpdate="True" 
        EnableDelete="True" onselecting="ForumTemplateDetailsLinqDataSource_Selecting">
        </asp:LinqDataSource>

        <asp:LinqDataSource ID="TemplateDetailsLinqDataSource" runat="server" 
            ContextTypeName="WCrawlerLib.LinqDataClassesDataContext" EntityTypeName="" 
            TableName="TemplateDetails" 
        onselecting="TemplateDetailsLinqDataSource_Selecting" EnableUpdate="True">
        </asp:LinqDataSource>